<#assign resources="${rc.contextPath}/resources">
<#assign path="${rc.contextPath}">
<head>
<meta charset="UTF-8">
    <title>购物车</title>
    <script>
    	var path="${path}";
    	var marketId="${marketId}";    	var total="${total}";    </script>	
    <style>
		    .not{
			margin-top: 50px;
		}
		.not .imgNot {
		  width: 120px;
		  height: 150px;
		  margin: 30px auto;
		}
		.not .imgNot img {
		  width: 100%;
		  height: 100%;
		  display: block;
		}
		.not #merchandise {
		  width: 90%;
		  margin: 30px auto;
		  height: 40px;
		  line-height: 40px;
		  text-align: center;
		  color: #fff;
		  background: #ff7f00;
		  display: block;
		  border-radius: 5px;
		}
		</style>
    	
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link href="${resources}/plugins/fontAwesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/common.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/cart.css" rel="stylesheet" type="text/css">
     <#include "setwxshare.ftl"/>
</head>


<body>
<div id="container">
   <div class="commonHeader">购物车
        <a href="${path}/index" onclick="javascript:window.history.back();" class="fa fa-chevron-left back"></a>
    </div>
     
    <div class="shops">
    	<#if (cartGoodsList?size==0) >
		<div class="not">
	        <div class="imgNot">
	            <img src="${resources}/images/1_05.png">
	        </div>
	        <a href="${path}/commodity/index/3" id="merchandise">逛逛商城</a>
	    </div>
    	</#if>
    <#list cartGoodsList as cartgood>
        <!--店铺-->
        <div class="shop" >
            <div class="shop-title">${cartgood.merchant.name}<span> &nbsp;<!-- ${cartgood.activity.name}--></span>
            </div> 
			<#list cartgood.list as CartItem>
	            <!--商品列表-->
	            <div class="goods" id="cart_item_${CartItem.goods.id}">
	                <input type="checkbox" name="checkboxname"  data-id='${CartItem.goods.id}' class="checkbox" onclick="checkCartItem(${(CartItem.status==1)?string('2','1')},${CartItem.goods.id},this)"  check="${(CartItem.status==2)?string('1','2')}"  <#if  CartItem.status ==2>checked="checked"</#if>  />
	                <i class="fa fa-trash-o" onClick="deleteGoods(${CartItem.goods.id},${marketId})"  aria-hidden="true"></i>
	                <div class="goods-pic">
	                    <img src="${CartItem.goods.picurl}" alt="">
	                </div>
	                <h3 class="goods-name">${CartItem.goods.name}</h3>
	                <div class="goods-price">
	                    ￥<span id="price_${CartItem.goods.id}">${CartItem.goods.price}</span>元
	                    <span class="goodsNum">x1</span>
	                </div>
	                <div class="num-module">
	                    <span class="minus" onclick="saveOrUpdate(${CartItem.goods.id},1,this)">-</span>
	                    <input type="text" readonly="true"  value="${CartItem.amount}" id="goods_${CartItem.goods.id}">
	                    <span class="plus enable" onclick="saveOrUpdate(${CartItem.goods.id},2,this)">+</span>
	                </div>
	            </div>
			</#list>
           <!--  <div class="subtotal">
                <span id="span_${cartgood.merchant.id}">小计：￥${cartgood.totalPrice}</span>-->
                <!-- <span class="cross-price">￥155.00</span> 
            </div>
           -->
           <!-- <a href="javascript:void (0)" class="favorable">再买12元可以优惠15元哦
                <span class="go">去凑单<span class="fa fa-chevron-right"></span></span>
            </a>
			-->
        </div>
</#list>
    </div>

<#if (cartGoodsList?size > 0 )>
    <div class="total">
		
		<input type="checkbox" id="selectAll" class="checkbox" id="selectAll"  ><label for="selectAll">全选</label>
		

        <p class="tip">${activity.name}</p>
        <p class="total-price" id="total">合计：￥${total}元</p>

        <a class="submit-order" href="javascript:void(0)" onclick="submitOrder()">提交订单</a>
    </div>
    
</#if>
 <!-- 导航栏 -->

 <ul class="homeButton">
        <li>
            <a href="${path}/index"  class="home">
                <img src="${resources}/images/1_10_33.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/article/index" class="bank">
                <img src="${resources}/images/1_10_24.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/bbs" class="local">
                <img src="${resources}/images/1_10_26.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/manage/commodityCart/cartShow?marketId=3" class="local">
                <img src="${resources}/images/1_9_28.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/manage/member" class="personalCenter">
                <img src="${resources}/images/1_10_30.png" alt="">
            </a>
        </li>
    </ul>
    
</div>
</body>

<script src="${resources}/plugins/jquery/2.2.2/jquery.min.js"></script>
<script src="${resources}/js/cart.js"></script>
<script src="${resources}/js/common.js"></script>
 


<script>

 	function submitOrder(){
 		
 		if($("input[type=checkbox]:checked").length>0){
 			 window.location.href="${path}/manage/commodityOrder/order/${marketId}";
 		}else{
 			common.alert({content:"请至少选择一个商品"});
 		}
 		
  }
  
    
  
</script>
 

 
